define(['gd','et','xp','qb','jq'], () => {
    console.log('这是as')
    class Mes {
        constructor() {
            this.ul1 = document.querySelector('.ul1')
            this.list=list
            this.creat()
        }
        creat() {
            var str=
            this.str=''
            for (let i = 0; i < list.length; i++) {
               this.str += `
                <li>
                <div class="book">
                <div class="pic">
                <img src="${this.list[i].url}">
                <div class="num">
                 <span class="iconfont icon-18erji-2"></span>
                  <span>${this.list[i].num}</span>
                </div>
                </div>
                <p>${this.list[i].title}</p>
                <span>${this.list[i].pyr}</span>      
                </div>
                <button class='but'>+</button>
                </li>
                `
            }
            // this.str=this.str+'</ul>'
            this.ul1.innerHTML=this.str
        }
    }
    new Mes()
    class Mess {
        constructor() {
            this.ul2 = document.querySelector('.ul2')
            this.list1=list1
            this.creat()
        }
        creat() {
            var str=
            this.str=''
            for (let i = 0; i < this.list1.length; i++) {
               this.str += `
                <li>
                <div class="book">
                <div class="pic">
                <img src="${this.list1[i].url}">
                <div class="num">
                 <span class="iconfont icon-18erji-2"></span>
                  <span>${this.list1[i].num}</span>
                </div>
                </div>
                <p>${this.list1[i].title}</p>
                <span>${this.list1[i].pyr}</span>      
                </div>
                <button class='but'>+</button>
                </li>
                `
            }
            // this.str=this.str+'</ul>'
            this.ul2.innerHTML=this.str
        }
    }
    new Mess()
    class Messs {
        constructor() {
            this.ul3 = document.querySelector('.ul3')
            this.list2=list2
            this.creat()
        }
        creat() {
            var str=
            this.str=''
            for (let i = 0; i < this.list2.length; i++) {
               this.str += `
                <li>
                <div class="book">
                <div class="pic">
                <img src="${this.list2[i].url}">
                <div class="num">
                 <span class="iconfont icon-18erji-2"></span>
                  <span>${this.list2[i].num}</span>
                </div>
                </div>
                <p>${this.list2[i].title}</p>
                <span>${this.list2[i].pyr}</span>      
                </div>
                <button class='but'>+</button>
                </li>
                `
            }
            // this.str=this.str+'</ul>'
            this.ul3.innerHTML=this.str
        }
    }
    new Messs()
    class Mesall {
        constructor() {
            this.ul0 = document.querySelector('.ul0')
            this.lists=lists
            this.creat()
            // this.add()
            // this.num()
        }
        creat() {
            var str=
            this.str=''
            for (let i = 0; i < lists.length; i++) {
               this.str += `
                <li did=${this.lists[i].id}>
                <div class="book">
                <div class="pic">
                <img src="${this.lists[i].url}">
                <div class="num">
                 <span class="iconfont icon-18erji-2"></span>
                  <span>${this.lists[i].num}</span>
                </div>
                </div>
                <p>${this.lists[i].title}</p>
                <span>${this.lists[i].pyr}</span>      
                </div>
                <button class='but' bid=${this.lists[i].id}>+</button>
                </li>
                `
            }
            // this.str=this.str+'</ul>'
            this.ul0.innerHTML=this.str
        }
        // add(){
        //     this.ul.onclick=(e)=>{
        //         var e = e || window.event
        //         var target = e.target || e.srcElement
        //         if(target.nodeName=='BUTTON'){
        //             var tid=target.dataset.id
        //             let goods=this.lists.find((item)=>{
        //                 return item.id == tid
        //             })
        //             let blist=JSON.parse(localStorage.getItem('car')) || []
        //             if(blist.length>0){
        //                 let result=blist.some((item)=>{
        //                     return item.id == tid
        //                 })
        //                 if(result){
        //                     let index=blist.findIndex((item)=>{
        //                         return item.id == tid
        //                     })
        //                     blist[index].cart_number++
        //                 }else{
        //                     goods.cart_number=1
        //                 blist.push(goods)
        //                 }
        //             }else{
        //                 goods.cart_number=1
        //                 blist.push(goods)
        //             }
        //             localStorage.setItem('car',JSON.stringify(blist))
        //             this.num()
        //         }
        //     }
        // }
        // num(){
        //     this.span=document.querySelector('.ass');
        //     let list=JSON.parse(localStorage.getItem('car')) ||[]
        //     let num=0
        //     list.forEach((item)=>{
        //         num+=Number(item.cart_number)
        //         num=Number(num)
        //     })
        //     this.creat()
        //     num=Number(num)
        //     this.span.innerHTML=num
           
            
        // }
    }
    new Mesall()
});